<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    util.xurl = function (option) {

        var _ = require('underscore.js');
        var md5 = require('md5.js');
        var app = getApp();

        var option = option ? option : {};
        option.cachetime = option.cachetime ? option.cachetime : 0; //缓存时间

        var sessionid = wx.getStorageSync('userInfo').sessionid;
        var url = option.url;

        // 如果要检索的字符串值没有出现，则该方法返回 -1。
        if (url.indexOf('http://') == -1 && url.indexOf('https://') == -1) {
            url = util.url(url);
        }
        // 获取链接某个参数
        var state = getUrlParam(url, 'state');
        if (!state && !(option.data && option.data.state) && sessionid) {
            url = url + '&state=we7sid-' + sessionid
        }

        if (!option.data || !option.data.m) {

            var nowPage = getCurrentPages()[getCurrentPages().length - 1];

            url = url + '&m=' + nowPage.route.split('/')[0];
        }

        var sign = getSign(url, option.data);
        if (sign) {
            url = url + "&sign=" + sign;
        }

        if (!url) {
            return false;
        }
        return url;

    }
</script>
</body>
</html>